package com.serie402.web.jsf.mb;

import org.apache.log4j.Logger;

import com.kiss.fw.jsf.mb.AbstractManagedBean;
import com.serie402.common.bo.News;

public class MenuManagedBean extends AbstractManagedBean {
	private static Logger logger = Logger.getLogger(MenuManagedBean.class);
	private static News newsBoxedContent;
	private static News sportsBoxedContent;
	
	public News getNewsBoxedContent() {
		return newsBoxedContent;
	}
	
	public News getSportsBoxedContent() {
		return sportsBoxedContent;
	}
	
	public String getNewsImportance() {
		return getImportance(newsBoxedContent);
	}
	
	public String getSportsNewsImportance() {
		return getImportance(sportsBoxedContent);
	}
	
	public String getLoggedInUserId() {
		logger.debug("getLoggedInUserId()");
		return "USER ID";
	}
	
	public static synchronized void setNewsBoxedContent(final News _newsBoxedContent) {
		newsBoxedContent = _newsBoxedContent;
	}
	
	public static synchronized void setSportsBoxedContent(final News _sportsBoxedContent) {
		sportsBoxedContent = _sportsBoxedContent;
	}
	
	private String getImportance(News _news) {
		String returnVal = "--";
		
		switch(newsBoxedContent.getImportance()) {
			case 1: returnVal = ""; break;
			case 2: returnVal = ""; break;
			case 3: returnVal = ""; break;
			case 4: returnVal = "HOT"; break;
			case 5: returnVal = "BREAKING NEWS"; break;
		};
		
		return returnVal;
	}
}